<?php require_once('../../Connections/shopcarda1.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

$colname_link = "-1";
if (isset($_GET['val'])) {
  $colname_link = $_GET['val'];
}
mysql_select_db($database_shopcarda1, $shopcarda1);
$query_link = sprintf("SELECT * FROM supplier_brand WHERE cm_id = %s ORDER BY sb_id ASC", GetSQLValueString($colname_link, "int"));
$link = mysql_query($query_link, $shopcarda1) or die(mysql_error());
$row_link = mysql_fetch_assoc($link);
$totalRows_link = mysql_num_rows($link);


do {
//$arr = array ('pst_id' => $row_link['pst_id'], 'type' => //$row_link['type'], 'sub_type' => $row_link['sub_type']);
//$list[] = $arr;
$data[$row_link['sb_id']] = $row_link['logo_name'];
    } while ($row_link = mysql_fetch_assoc($link));   

echo json_encode($data);
//echo json_encode($list);
	
mysql_free_result($link);
?>
